home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
programming
/
languages
/
oberon.lha
/
system
/
In.Mod
(
.txt
)
< prev
next >
Wrap
Oberon Text
|
1990-01-01
|
2KB
|
58 lines
Syntax10.Scn.Fnt
MODULE In;
(* Stream-oriented text input, MR 1992, NW 22.5.93 *)
IMPORT Texts, Viewers, Oberon, TextFrames;
VAR Done*: BOOLEAN;
S: Texts.Scanner;
PROCEDURE Open*;
VAR beg, end, time: LONGINT;
V: Viewers.Viewer;
T: Texts.Text;
BEGIN Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
IF (S.class = Texts.Char) & (S.c = "^") THEN
(* start input stream at beginning of selection *)
Oberon.GetSelection(T, beg, end, time);
IF time >= 0 THEN Texts.OpenScanner(S, T, beg); Done := TRUE
ELSE Done := FALSE
END
ELSIF (S.class = Texts.Char) & (S.c = "*") THEN
(* start input stream at beginning of text in marked viewer *)
V := Oberon.MarkedViewer();
IF (V.dsc # NIL) & (V.dsc.next IS TextFrames.Frame) THEN
T := V.dsc.next(TextFrames.Frame).text; Texts.OpenScanner(S, T, 0); Done := TRUE
ELSE Done := FALSE
END
ELSE (* start input stream after command name *)
T := Oberon.Par.text; Texts.OpenScanner(S, T, Oberon.Par.pos); Done := TRUE
END Open;
PROCEDURE Char*(VAR ch: CHAR);
BEGIN
IF Done THEN ch := S.nextCh; Done := ~S.eot; Texts.Read(S, S.nextCh) END
END Char;
PROCEDURE Int*(VAR i: INTEGER);
BEGIN
IF Done THEN Texts.Scan(S); i := SHORT(S.i); Done := (S.class = Texts.Int) END
END Int;
PROCEDURE LongInt*(VAR i: LONGINT);
BEGIN
IF Done THEN Texts.Scan(S); i := S.i; Done := (S.class = Texts.Int) END
END LongInt;
PROCEDURE Real*(VAR x: REAL);
BEGIN
IF Done THEN Texts.Scan(S); x := S.x; Done := (S.class = Texts.Real) END
END Real;
PROCEDURE LongReal*(VAR y: LONGREAL);
BEGIN
IF Done THEN Texts.Scan(S); y := S.y; Done := (S.class = Texts.LongReal) END
END LongReal;
PROCEDURE Name*(VAR name: ARRAY OF CHAR);
BEGIN
IF Done THEN Texts.Scan(S); COPY(S.s, name); Done := (S.class = Texts.Name) END
END Name;
PROCEDURE String*(VAR str: ARRAY OF CHAR);
BEGIN
IF Done THEN Texts.Scan(S); COPY(S.s, str); Done := (S.class = Texts.String) END
END String;
BEGIN Done := FALSE
END In.